# 172  中等：阶乘后的零

import math


class Solution:
    def trailingZeroes(self, n: int) -> int:
        fac = math.factorial(n)
        ret = 0
        while fac != 0:
            if fac % 10 == 0:
                ret += 1
            else:
                break
            fac = fac // 10
        return ret


    def trailingZeroes1(self, n: int) -> int:
        count = 0
        while n > 0:
            count += n / 5
            n = n / 5
        return count


s = Solution()
print(s.trailingZeroes(7))
